/*
 * AutoLock.h
 *
 *  Created on: 2012-10-15
 *      Author: tony
 */

#ifndef AUTOLOCK_H_
#define AUTOLOCK_H_

template <class T> class AutoLock
{
public:
	AutoLock(T& sync_object )
	: m_sync_object(sync_object)
	{
		m_sync_object.Lock();
	}

	virtual ~AutoLock()
	{
		m_sync_object.Unlock();
	}

private:

	T& m_sync_object;
};

#endif /* AUTOLOCK_H_ */
